import { useState } from 'react';

export default function (basicColumns) {
    const [columns] = useState(() => {
        let v = [];
        basicColumns.forEach((item) => {
            let filters, filterOption, onFilter;
            if (item.key === 'name') {
                filters = [
                    {
                        text: 'Xanthus Lawrence',
                        value: 'Xanthus Lawrence',
                    },
                    {
                        text: 'Lisandra Miranda',
                        value: 'Lisandra Miranda',
                    },
                    {
                        text: 'Ginger Barrera',
                        value: 'Ginger Barrera',
                    },
                ];
                onFilter = (v, record) => {
                    return record.name === v;
                }
            } else if (item.key === 'country') {
                filterOption = {
                    type: 'date'
                }
            }
            v.push({ ...item, filters, filterOption, onFilter })
        })
        return v;
    });
    return columns;
}